<style>
  .is_count{
    font-size: 12px;
    height: 32%;
  }
  .is_count_div{
    height: 150px;
  }
</style>
<template>
  <div class="dashboard-editor-container">
    <div>
      <el-date-picker
        v-model="time"
        type="daterange"
        range-separator="至"
        style="width: 400px;"
        start-placeholder="开始日期"
        end-placeholder="结束日期"
        @keyup.enter.native="get_goods_data"/>
      <el-button type="primary" icon="el-icon-search" @click="get_goods_data">搜索</el-button>
    </div>
    <div style="display: flex;">
      <div style="flex: 1">
        <el-table
          :data="goods_data.goods_sales_volume"
          style="width: 390px;margin: 10px">
          <el-table-column label="商品销量排名" style="left: 30px">
            <el-table-column
              type="index"
              label="排名"
              width="50"/>
            <el-table-column
              prop="goodName"
              label="商品名称"
              width="260"/>
            <el-table-column
              prop="salesVolume"
              label="销量"
              width="80"/>
          </el-table-column>
        </el-table>
      </div>
      <div style="flex: 1">
        <el-table
          :data="goods_data.goods_search"
          style="width: 392px;margin: 10px">
          <el-table-column label="搜索词排名" style="left: 30px">
            <el-table-column
              type="index"
              label="排名"
              width="50"/>
            <el-table-column
              prop="searchText"
              label="搜索词"
              width="260"/>
            <el-table-column
              prop="num"
              label="搜索次数"
              width="80"/>
          </el-table-column>
        </el-table>
      </div>
    </div>
  </div>
</template>

<script>
import GithubCorner from '@/components/GithubCorner'
import RaddarChart from './components/RaddarChart'
import PieChart from './components/PieChart'
import BarChart from './components/BarChart'
import TransactionTable from './components/TransactionTable'
import TodoList from './components/TodoList'
import BoxCard from './components/BoxCard'
import { companyGoodsDataStatistics } from '@/api/merchant/merchant'
import store from '@/store'
export default {
  name: 'DashboardAdmin',
  components: {
    GithubCorner,
    RaddarChart,
    PieChart,
    BarChart,
    TransactionTable,
    TodoList,
    BoxCard
  },
  data() {
    return {
      time: [],
      dateTime: '',
      message: [],
      goods_data: []
    }
  },
  created: function() {
    this.get_goods_data()
  },
  methods: {
    handleSetLineChartData(type) {
      this.$emit('handleSetLineChartData', type)
    },
    get_goods_data() {
      companyGoodsDataStatistics(store.getters.token, this.time).then(res => {
        this.goods_data = res.data
        console.log('333333', this.goods_data)
      })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  .dashboard-editor-container {
    padding: 32px;
    background-color: rgb(240, 242, 245);
    .chart-wrapper {
      background: #fff;
      padding: 16px 16px 0;
      margin-bottom: 32px;
    }
  }
</style>
